/*
 * @lc app=leetcode.cn id=1523 lang=javascript
 *
 * [1523] 在区间范围内统计奇数数目
 */

// @lc code=start
/**
 * @param {number} low
 * @param {number} high
 * @return {number}
 */
var countOdds = function (low, high) {
  let diff = high - low + 1;
  if (diff % 2 === 0) {
    return diff / 2;
  }
  if (high % 2 === 1) {
    return (diff + 1) / 2;
  }
  return (diff + 1) / 2 - 1;
};
// @lc code=end

